package com.pactera.madp.cp.controller.oms.sync;

import com.pactera.madp.common.core.util.R;
import com.pactera.madp.common.security.annotation.Inner;
import com.pactera.madp.cp.api.dto.sync.SyncDTO;
import com.pactera.madp.cp.service.sync.SyncService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @title 同步控制类
 * @date 2022-05-11
 * @author Deming.Chang
 */
@Inner
@Slf4j
@RestController
@RequestMapping("/sync")
@RequiredArgsConstructor
@Api(value = "sync", tags = "同步控制类")
public class SyncController {

    private final SyncService syncService;

    @ApiOperation(value = "同步数据")
    @PostMapping("/data")
    public R<Boolean> sync(@RequestBody SyncDTO dto){
        return R.ok(syncService.handler(dto));
    }

    @ApiOperation(value = "同步员工回调接口")
    @GetMapping("/business/psn")
    public void syncPsnBusiness() {
        syncService.syncPsnBusiness();
    }
}
